<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('量表')" />
    <th:block th:include="include :: select2-css" />
    <style type="text/css">
        .tdVertical{
            font-size: 15px;
            font-weight: 600;
            background-color:#e7eaec!important;
            padding: 8px;
            vertical-align: middle;
            max-width: 300px;
            min-width: 150px;
            border-bottom: 1px solid rgb(221, 221, 221)!important;
        }
        .form-row {
            margin-bottom: 8px;
            margin-left: 40px;
            font-size: 14px;
            position: relative;
        }
        .form-row .title {
            display: inline-block;
            line-height: 38px;
            width: 100px;
            position: absolute;
            top: 10px;
            left: 0px;
        }
        .form-row textarea {
            width: 87%;
            border: 1px solid #e0e0e0;
            padding: 13px;
            height: 88px;
            resize: none;
            margin-left: 100px;
        }
        .checkbox, .radio{
            margin: 0px;
        }
        code{
            font-size: 112%;
            color: rgb(103, 106, 108);
        }

        .selectRadio{
            color:red;
            background-color: antiquewhite;
            font-size: 15px;
            font-weight: 900!important;
        }
        .selectRadio code{
            color:red;
            background-color: antiquewhite
        }
        .form-input{
            display: inline-block;
            width: 100%;
        }
    </style>
</head>
<body class="gray-bg">
<input id="editFlag" th:value="${editFlag}" type="hidden">
<input id="ecId" name="ecId" th:value="${evContent.ecId}" type="hidden">
<input id="ecStatus" name="ecStatus" th:value="${evContent.ecStatus}" type="hidden">
<input id="ecScore" name="ecScore" th:value="${evContent.ecScore}" type="hidden">
<input id="recordId" name="recordId" th:value="${evContent.ecFormRecordId}" type="hidden">
<input id="ecFiles" name="ecFiles" th:value="${evContent.ecFiles}" type="hidden">
<input id="versionId" name="versionId" th:value="${versionId}" type="hidden">
<input id="admId" th:value="${admId}" type="hidden">
<div class="wrapper wrapper-content" style="overflow-x: auto">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title " style="text-align: center">
                    <h1>[[${layout.layoutName}]]</h1>
                </div>
                <div class="ibox-content" style="padding-bottom: 0px">
                    <div class="select-list" >
                        <ul>
                            <li>
                                <p >登记号：</p>
                                <input type="text" id="patNo" th:value="${hisAdm?.hisPatient?.patNo}"
                                       disabled
                                       style="background-color: hsl(0deg 0% 96%);" />
                            </li>
                            <li>
                                <p>姓名：</p>
                                <input type="text" id="patName" th:value="${hisAdm?.hisPatient?.patName}"
                                       disabled
                                       style="background-color: hsl(0deg 0% 96%);">
                            </li>
                            <li>
                                <p>性别：</p>
                                <input type="text" id="patSex" th:value="${hisAdm?.hisPatient?.patSex}"
                                       disabled
                                       style="width: 50px;background-color: hsl(0deg 0% 96%);">
                            </li>
                            <li>
                                <p>年龄：</p>
                                <input type="text" id="patAge" th:value="${hisAdm?.hisPatient?.patAge}"
                                       disabled
                                       style="width: 50px;background-color: hsl(0deg 0% 96%);">
                            </li>
                            <li>
                                <p>床号：</p>
                                <input type="text" id="admBed" th:value="${hisAdm?.admBed}" disabled
                                       style="width: 50px;background-color: hsl(0deg 0% 96%);">
                            </li>
                        </ul>
                    </div>
                    <form method="post" id="form-save">
                        <div th:each="rows:${root}" class="row">
                            <div th:each="columns:${rows.childrens}" th:class="${columns.cellStyle}">
                                <div th:each="cell:${columns.childrens}" >
                                    <div th:if="${cell.dict} != null" th:object="${cell.dict}">
                                        <div th:switch="${cell.dict.dictType}" >
                                            <!--radio-->
                                            <div th:case="'radio'" class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <div class="radio radio-box" th:each="dict :${cell.dict.dicts}">
                                                        <label style="padding-left: 0!important;">
                                                            <input type="radio" th:value="${dict.dictId}" th:name="${cell.dict.dictId}" th:checked="${dict.recordItm}!=null? true : false">
                                                            <i></i>
                                                            [[${dict.dictTitle}]]
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--checkbox-->
                                            <div th:case="'checkbox'" class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <label th:each="dict :${cell.dict.dicts}" class="check-box">
                                                        <input type="checkbox" th:value="${dict.dictId}" th:text="${dict.dictTitle}" th:name="${cell.dict.dictId}" th:checked="${dict.recordItm}!=null? true : false">
                                                    </label>
                                                </div>
                                            </div>
                                            <!--select-->
                                            <div th:case="'select'" class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <select th:name="${cell.dict.dictId}" class="form-control m-b" >
                                                        <option th:each="dict : ${cell.dict.dicts}" th:text="${dict.dictTitle}" th:value="${dict.dictId}" th:selected="${dict.recordItm}!=null"  ></option>
                                                    </select>
                                                </div>
                                            </div>
                                            <!--datepicker-->
                                            <div th:case="'datepicker'" class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <div class="input-group date">
                                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                        <input type="text" class="form-control datepicker" th:name="${cell.dict.dictId}" th:value="${cell.dict.recordItm?.value}">
                                                    </div>
                                                </div>
                                            </div>
                                            <!--datetimepicker-->
                                            <div th:case="'datetimepicker'" class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <div class="input-group date">
                                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                        <input type="text" class="form-control datetimepicker" th:name="${cell.dict.dictId}" th:value="${cell.dict.recordItm?.value}">
                                                    </div>
                                                </div>
                                            </div>
                                            <!--texarea-->
                                            <div th:case="'textarea'"  class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <textarea th:name="${cell.dict.dictId}" maxlength="500" class="form-control" rows="3" th:text="${cell.dict.recordItm?.value}"></textarea>
                                                </div>
                                            </div>
                                            <!--header-->
                                            <div th:case="'header'"  class="form-group">
                                                <h4 class="form-header h4" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </h4>
                                            </div>
                                            <!--table-->
                                            <div th:case="'table'"  class="form-group">

                                                <h4 class="h4" th:text="${cell.dict.dictTitle}" th:unless=="${cell.dict.dictExpand=='Y'}"></h4>
                                                <table th:if="${cell.dict.dictExpand eq 'Y'}"
                                                       class="table table-bordered"
                                                       th:id="${#strings.concat('table',cell.dict.dictId)}">
                                                    <tbody>
                                                    <tr th:each="rowDict : ${cell.dict.dicts[0].dicts}" >
                                                        <td class="tdVertical" style="border-bottom: 1px solid
                                                            rgb(221, 221, 221)!important;" th:title="${rowDict?.remark}">
                                                            [[${rowDict?.dictTitle}]]
                                                        </td>
                                                        <td th:each=" columnDict: ${cell.dict.dicts[0].dicts[rowDictStat.index]}" >
                                                            <div th:if=" ${columnDict.dictType} eq 'datepicker'" class="input-group date">
                                                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                <input type="text"
                                                                       class="form-control datepicker"
                                                                       th:name="${#strings.concat(columnDict.dictId,cell.dict.dicts[0].rowKey)}"
                                                                       th:value="${columnDict.recordItm?.value}">
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'radio'" class="radio check-box" th:each="tdDict :${columnDict.dicts}">
                                                                <label style="padding-left: 0!important;">
                                                                    <input type="radio"
                                                                           th:value="${tdDict.dictId}"
                                                                           th:name="${#strings.concat(columnDict.dictId,cell.dict.dicts[0].rowKey)}"
                                                                           th:checked="${tdDict.recordItm}!=null? true : false"
                                                                           th:data-score="${tdDict.dictScore}"
                                                                           th:data-auto-score="${columnDict.dictAutoScore}"
                                                                           th:data-parent-title="${rowDict?.dictTitle}"
                                                                           th:data-row-key="${cell.dict.dicts[0].rowKey}" >
                                                                    <i></i>
                                                                    [[${tdDict?.dictTitle}]]
                                                                </label>
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'checkbox'" class="checkbox check-box" th:each="tdDict :${columnDict.dicts}">
                                                                <label style="padding-left: 0!important;">
                                                                    <input type="checkbox"
                                                                           th:value="${tdDict.dictId}"
                                                                           th:name="${#strings.concat(columnDict.dictId,cell.dict.dicts[0].rowKey)}"
                                                                           th:checked="${tdDict.recordItm}!=null? true : false">
                                                                    <i></i>
                                                                    [[${tdDict.dictTitle}]]
                                                                </label>
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'input'" >
                                                                <input th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                       class="form-control "
                                                                       type="text"
                                                                       th:value="${columnDict.recordItm?.value}"
                                                                       th:data-dict-code="${#strings.concat(columnDict.dictCode,rowDict.rowKey)}">
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                                <table th:unless=="${cell.dict.dictExpand=='Y'}"
                                                       class="table table-bordered"
                                                       th:id="${#strings.concat('table',cell.dict.dictId)}">
                                                    <thead>
                                                    <tr >
                                                        <th th:each="columnDict : ${cell.dict.dicts[0].dicts}" th:text="${columnDict.dictTitle}" style="background-color:#e7eaec!important" th:width="${columnDict.dictWidth}">
                                                        </th>

                                                        <th th:if="${cell.dict.dictCopy} eq 'Y'" style="background-color:#e7eaec!important" width="50">
                                                            <button class="btn btn-info btn-circle" type="button"  th:onclick="|addTableRow(${cell.dict.dictId})|" ><i class="fa fa-plus"></i></button>
                                                        </th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr th:each="rowDict : ${cell.dict.dicts}" th:id="${#strings.concat('tr',rowDict.rowKey)}" >
                                                        <td th:each=" columnDict: ${rowDict.dicts}" >
                                                            <div th:if=" ${columnDict.dictType} eq 'datepicker'" class="input-group date">
                                                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                <input type="text" class="form-control datepicker"  th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" th:value="${columnDict.recordItm?.value}">
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'radio'" class="radio check-box" th:each="tdDict :${columnDict.dicts}">
                                                                <label style="padding-left: 0!important;">
                                                                    <input type="radio" th:value="${tdDict.dictId}" th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" th:checked="${tdDict.recordItm}!=null? true : false" th:data-score="${tdDict.dictScore}" th:data-auto-score="${cell.dict.dictAutoScore}" th:data-row-key="${rowDict.rowKey}" >
                                                                    <i></i>
                                                                    [[${tdDict.dictTitle}]]
                                                                </label>
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'checkbox'" class="checkbox check-box" th:each="tdDict :${columnDict.dicts}">
                                                                <label style="padding-left: 0!important;">
                                                                    <input type="checkbox" th:value="${tdDict.dictId}" th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" th:checked="${tdDict.recordItm}!=null? true : false">
                                                                    <i></i>
                                                                    [[${tdDict.dictTitle}]]
                                                                </label>
                                                            </div>
                                                            <div th:if=" ${columnDict.dictType} eq 'input'" >
                                                                <input th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" class="form-control " type="text" th:value="${columnDict.recordItm?.value}" th:data-dict-code="${#strings.concat(columnDict.dictCode,rowDict.rowKey)}">
                                                            </div>
                                                        </td>
                                                        <td th:if="${cell.dict.dictCopy} eq 'Y'" th:data-id="${rowDict.rowKey}">
                                                            <button class="btn btn-danger btn-circle" type="button" th:onclick="removeTableRow(this)"  ><i class="fa fa-remove"></i></button>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>

                                            <!--divtable-->
                                            <div th:case="'divtable'"  class="form-group">
                                                <div class="ibox"
                                                     th:if="${cell.dict.remark != null }"
                                                     style="margin-top: 10px">
                                                    <div class="ibox-content" style="padding-bottom: 5px" >
                                                        <code style="color: black;font-weight: bold">量表说明:</code>
                                                        <span id="layoutRemark">[[${cell.dict.remark}]]</span>
                                                    </div>
                                                </div>
                                                <table class="table table-bordered"
                                                       th:id="${#strings.concat('table',cell.dict.dictId)}"
                                                       th:data-id="${cell.dict.dictId}"
                                                       th:classappend="${'Y' eq cell.dict.dictAutoScore? 'autoScore':''}">
                                                    <tbody>
                                                    <tr th:each="rowDict : ${cell.dict.dicts}" th:id="${#strings.concat('tr',rowDict.rowKey)}" >
                                                        <td th:each=" columnDict: ${rowDict.dicts}"
                                                            th:colspan="${columnDict.dictColspan}"
                                                            th:rowspan="${columnDict.dictRowspan}">

                                                            <strong >
                                                                [[${columnDict.dictTitle}]]
                                                            </strong>
                                                            <strong
                                                                    th:if="${!#strings.isEmpty(columnDict.dictTip)}"
                                                                    data-toggle="tooltip" data-placement="top"
                                                                    th:title="${columnDict.dictTip}">
                                                                <i class="fa fa-question-circle-o"
                                                                   style="cursor: pointer"></i>
                                                            </strong>

                                                            <strong th:each="tdDict :${columnDict.dicts}">
                                                                <br th:if="${tdDict.dictWrap} eq 'Y'">

                                                                <div th:if=" ${tdDict.dictType} eq 'datepicker'" class="input-group date">
                                                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                    <input type="text" class="form-control datepicker"  th:name="${#strings.concat(tdDict.dictId,rowDict.rowKey)}" th:value="${tdDict.recordItm?.value}">
                                                                </div>

                                                                <div th:if=" ${tdDict.dictType} eq 'datetimepicker'" class="input-group date">
                                                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                    <input type="text" class="form-control datetimepicker"  th:name="${#strings.concat(tdDict.dictId,rowDict.rowKey)}" th:value="${tdDict.recordItm?.value}">
                                                                </div>

                                                                <div th:if=" ${columnDict.dictType} eq 'radio'" class="radio check-box" >
                                                                    <label style="padding-left: 0!important;">
                                                                        <input type="radio"
                                                                               th:if="${evContent?.ecFormRecordId != null}"
                                                                               th:value="${tdDict.dictId}"
                                                                               th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                               th:checked="${tdDict.recordItm}!=null? true : false"
                                                                               th:data-score="${tdDict.dictScore}"
                                                                               th:data-auto-score="${cell.dict.dictAutoScore}"
                                                                               th:data-row-key="${rowDict.rowKey}" >
                                                                        <input type="radio"
                                                                               th:if="${evContent?.ecFormRecordId == null}"
                                                                               th:value="${tdDict.dictId}"
                                                                               th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                               th:checked="${tdDict.dictDefaultValue} == 'Y'? true : false"
                                                                               th:data-score="${tdDict.dictScore}"
                                                                               th:data-auto-score="${cell.dict.dictAutoScore}"
                                                                               th:data-row-key="${rowDict.rowKey}" >

                                                                        <i></i>
                                                                        [[${tdDict.dictTitle}]]
                                                                        <code th:if="${tdDict.dictScore != null }">
                                                                            ([[${tdDict.dictScore}]]分)
                                                                        </code>
                                                                    </label>
                                                                </div>


                                                                <div th:if=" ${columnDict.dictType} eq 'checkbox'" class="checkbox check-box" >
                                                                    <label style="padding-left: 0!important;">
                                                                        <input type="checkbox"
                                                                               th:if="${evContent?.ecFormRecordId != null}"
                                                                               th:value="${tdDict.dictId}"
                                                                               th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                               th:checked="${tdDict.recordItm}!=null? true : false"
                                                                               th:data-score="${tdDict.dictScore}"
                                                                               th:data-auto-score="${cell.dict.dictAutoScore}"
                                                                        >
                                                                        <input type="checkbox"
                                                                               th:if="${evContent?.ecFormRecordId == null}"
                                                                               th:value="${tdDict.dictId}"
                                                                               th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                               th:checked="${tdDict.dictDefaultValue} == 'Y'? true : false"
                                                                               th:data-score="${tdDict.dictScore}"
                                                                               th:data-auto-score="${cell.dict.dictAutoScore}"
                                                                        >
                                                                        <i></i>
                                                                        [[${tdDict.dictTitle}]]
                                                                        <code th:if="${tdDict.dictScore != null }">
                                                                            ([[${tdDict.dictScore}]]分)
                                                                        </code>
                                                                    </label>
                                                                </div>

                                                                <div th:if=" ${tdDict.dictType} eq 'input'" class="form-input">
                                                                    <input th:name="${#strings.concat(tdDict.dictId,rowDict.rowKey)}"
                                                                           class="form-control "
                                                                           type="text"
                                                                           th:value="${tdDict.recordItm?.value}"
                                                                           th:data-dict-code="${#strings.concat(tdDict.dictCode,rowDict.rowKey)}"
                                                                           th:if="${evContent?.ecFormRecordId != null}"
                                                                    >
                                                                    <input th:name="${#strings.concat(tdDict.dictId,rowDict.rowKey)}"
                                                                           class="form-control "
                                                                           type="text"
                                                                           th:data-dict-code="${#strings.concat(tdDict.dictCode,rowDict.rowKey)}"
                                                                           th:if="${evContent?.ecFormRecordId == null}"
                                                                           th:value="${tdDict.dictDefaultValue}"
                                                                    >
                                                                </div>

                                                                <!--image-->
                                                                <div th:if=" ${tdDict.dictType} eq 'image'">
                                                                    <img th:src="${@file.getPath(tdDict.dictPath)}"
                                                                         th:width="${tdDict.dictWidth}"
                                                                         th:height="${tdDict.dictHeight}"
                                                                         onclick="$.common.previewPic(this)" >
                                                                </div>


                                                            </strong>

                                                            <div th:if=" ${columnDict.dictType} eq 'select'" >
                                                                <select th:name="${columnDict.dictId}" class="form-control m-b" >
                                                                    <option th:each="dict : ${columnDict.dicts}" th:text="${dict.dictTitle}" th:value="${dict.dictId}" th:selected="${dict.recordItm}!=null"  ></option>
                                                                </select>
                                                            </div>

                                                            <div th:if=" ${columnDict.dictType} eq 'datepicker'" class="input-group date">
                                                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                <input type="text" class="form-control datepicker"  th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" th:value="${columnDict.recordItm?.value}">
                                                            </div>


                                                            <div th:if=" ${columnDict.dictType} eq 'datetimepicker'" class="input-group date">
                                                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                                <input type="text" class="form-control datetimepicker"  th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}" th:value="${columnDict.recordItm?.value}">
                                                            </div>

                                                            <div th:if=" ${columnDict.dictType} eq 'input'" class="form-input">
                                                                <input th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                       class="form-control "
                                                                       type="text"
                                                                       th:value="${columnDict.recordItm?.value}"
                                                                       th:data-dict-code="${#strings.concat(columnDict.dictCode,rowDict.rowKey)}"
                                                                       th:if="${evContent?.ecFormRecordId != null}"
                                                                >

                                                                <input th:name="${#strings.concat(columnDict.dictId,rowDict.rowKey)}"
                                                                       class="form-control "
                                                                       type="text"
                                                                       th:data-dict-code="${#strings.concat(columnDict.dictCode,rowDict.rowKey)}"
                                                                       th:if="${evContent?.ecFormRecordId == null}"
                                                                       th:value="${columnDict.dictDefaultValue}"
                                                                >
                                                            </div>

                                                            <!--image-->
                                                            <div th:if=" ${columnDict.dictType} eq 'image'">
                                                                <img th:src="${@file.getPath(columnDict.dictPath)}"
                                                                     th:width="${columnDict.dictWidth}"
                                                                     th:height="${columnDict.dictHeight}"
                                                                     onclick="$.common.previewPic(this)" >
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                                <div
                                                        style="padding-top: 5px;padding-bottom: 5px;background-color: #f5f5f5;text-align: center"
                                                        th:if="'Y' eq ${cell.dict.dictAutoScore}"
                                                >
                                                    <strong th:id="${'totalScoreDiv'+ cell.dict.dictId}" style="font-size: 20px">合计得分：</strong>
                                                    <strong th:if="${cell.dict.dictScore != null }" style="font-size:15px">
                                                        /总分([[${cell.dict.dictScore}]])
                                                    </strong>
                                                    <input th:id="${'ecScore'+cell.dict.dictId}" th:name="${cell.dict.dictId}"  type="hidden">
                                                </div>
                                            </div>

                                            <!--image-->
                                            <div th:case="'image'"  class="form-group">
                                                <img th:src="${@file.getPath(cell.dict.dictPath)}"
                                                     th:width="${cell.dict.dictWidth}"
                                                     th:height="${cell.dict.dictHeight}">
                                            </div>

                                            <!--label-->
                                            <div th:case="'label'"  class="form-group">
                                                <label >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                            </div>

                                            <div th:case="*"  class="form-group">
                                                <label class="col-sm-2 control-label" >
                                                    [[${cell.dict.dictTitle}]]
                                                    <strong
                                                            th:if="${!#strings.isEmpty(cell.dict.dictTip)}"
                                                            data-toggle="tooltip" data-placement="top"
                                                            th:title="${cell.dict.dictTip}">
                                                        <i class="fa fa-question-circle-o"
                                                           style="cursor: pointer"></i>
                                                    </strong>
                                                </label>
                                                <div class="col-sm-10">
                                                    <input th:name="${cell.dict.dictId}" class="form-control " type="text" th:value="${cell.dict.recordItm?.value}">
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </div>
    </div>
    <div class="row" style="padding-bottom: 15px">
        <div class="col-sm-12">
            <div class="ibox" >
                <div class="ibox-content" style="padding-bottom: 5px">
                    <form>
                        <table class="kv-table">
                            <tbody>
                            <tr>
                                <td class="kv-label" >量表评定结果:</td>
                                <td class="kv-content" style="width: 90%">
                                    <textarea class="form-control" id="ecContent" name="ecContent"  placeholder="量表评定结果" th:field="${evContent.ecContent}"></textarea>
                                </td>
                            </tr>
                            <tr style="display: none">
                                <td class="kv-label">注意事项:</td>
                                <td class="kv-content" >
                                    <textarea class="form-control" id="ecRemark"  placeholder="注意事项" th:field="${evContent.ecRemark}"></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="kv-label" style="height: 100px" >
                                    <a class="btn btn-success btn-xs "
                                       href="javascript:void(0)"
                                       onclick="upload()">
                                        附件 &nbsp&nbsp&nbsp&nbsp
                                        <i class="fa fa-upload"></i>
                                    </a>

                                    <a class="btn btn-primary btn-xs "
                                       href="javascript:void(0)"
                                       onclick="viewAllVideo()">
                                        预览视频
                                    </a>
                                    <div style="margin-top: 10px">
                                        <select name="rsGroup" id="rsGroup" class="form-control m-b"
                                                th:with="type=${@dict.getType('rs_group')}">
                                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                        </select>
                                    </div>
                                </td>
                                <td class="kv-content" id="uploadList">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>

        </div>
    </div>
    <div class="row" style="position: fixed;bottom: 10px;height: 30px;width: 100%" id="divBtn">
        <div id="buttonDiv" style="display:none;" class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn ele-btn-success" onclick="submitHandler('E')" id="BtnE"><i
                    class="fa fa-paste"></i>保存 </button>&nbsp;
            <button type="button" class="btn ele-btn-primary" onclick="submitHandler('C')" id="BtnC"><i
                    class="fa fa-check"></i>提交</button>&nbsp;
            <button type="button" class="btn ele-btn-danger" onclick="$.modal.close()" id="BtnClose"><i
                    class="fa fa-close"></i>关闭</button>
        </div>
    </div>
</div>

<th:block th:include="include :: footer" />

<script type="text/javascript">
    var layerIndex;
    $(function(){
        $("#buttonDiv").show();

        if(($("#editFlag").val()!='Y')){
            $("#BtnE").hide();
            $("#BtnC").hide();
        }
        if(($("#ecStatus").val()=='C')){
            $("#BtnE").hide();
            $("#BtnC").hide();
        }

        var temp=$("#layoutRemark").text().replace(/\n/g,'<br>')
        $("#layoutRemark").html(temp)
        //raido单击取消选中
        $("input[type='radio']").on('ifClicked', function(event){
            if($(this).is(":checked")){
                $(this).attr("checked",false);
                $(this).parent().parent().removeClass("selectRadio");
            }
            $("input[type='radio']").iCheck('update');
        });
        $("input[type='checkbox']").on('ifClicked', function(event){
            if($(this).is(":checked")){
                $(this).attr("checked",false);
                $(this).parent().parent().removeClass("selectRadio");
            }
            $("input[type='checkbox']").iCheck('update');
        });
        $("input[type='radio']").on("ifChecked",function () {
            initScore();
        });
        $("input[type='checkbox']").on("ifChecked",function () {
            initScore();
        });
        initScore();
        $("[data-toggle='tooltip']").tooltip();
        if ($("#ecFiles").val()=="") {
            $("#ecFiles").val("null");
        }
        $.common.addFileHtml("uploadList",JSON.parse($("#ecFiles").val()));
        console.log($("#editFlag").val());
    });

    function upload(){
        layerIndex=$.common.uploadFiles();
    }
    /**
     *  上传成功回调函数
     * @param arr
     */
    function uploadComplete(arr){
        $(arr).each(function (i,obj){
            obj.fileType=$("#rsGroup").val()
        })
        $.common.addFileHtml("uploadList",arr);
        layer.close(layerIndex);
    }
    var laydate;
    layui.use('laydate', function(){
        laydate = layui.laydate;

        $(".datepicker").each(function () {
            laydate.render({
                trigger:'click',
                elem: this
            });
        })
        $(".datetimepicker").each(function () {
            laydate.render({
                trigger:'click',
                type: 'datetime',
                elem: this
            });
        })
    });
    function submitHandler(status) {
        if ((status=="E")||(status=="C")) {
            if($("#ecContent").val()=="") {
                alert("\"量表评定结果\"不能为空");
                return;
            }
            var param={}
            param.ecFiles=$.common.getFileArr();
            param.rows=$('#form-save').serializeArray();
            param.versionId=$("#versionId").val();
            param.recordId=$("#recordId").val();
            param.admId=$("#admId").val();
            param.ecId=$("#ecId").val();
            param.ecStatus=status;
            param.ecContent=$("#ecContent").val();
            param.ecRemark=$("#ecRemark").val();
            param.ecScore=$("#ecScore").val();
            $.operate.postJson(ctx+"form/record/add",JSON.stringify(param),function (result){
                $.operate.successCallback(result);
                //$.operate.successTabCallback(result);
            });
        }else {
            $.modal.close();
        }

    }

    function removeTableRow(obj){
        $.modal.confirm("确定删除当前行吗？", function() {
            rowKey=$(obj).parent().attr("data-id");
            $("#tr"+rowKey).remove();
        })

    }
    function addTableRow(dictId) {
        $.ajax({
            url: ctx+"form/dict/tableRowHtml",
            type: "get",
            contentType: "application/json;charset=UTF-8",
            dataType: "json",
            data: {dictId:dictId},
            success: function(result) {
                if(result.code==0){
                    var rowKey=result.data.dicts[0].rowKey;
                    var html="<tr id='tr"+rowKey+"'>"
                    for (var i=0;i<result.data.dicts[0].dicts.length;i++){
                        var column=result.data.dicts[0].dicts[i];
                        var columnCode=result.data.dicts[0].dicts[i].dictCode;
                        var columnName=column.dictId+rowKey;
                        html=html+"<td>";
                        if(column.dictType=="input"){
                            html=html+"<input name='"+columnName+"' class='form-control' type='text' data-dict-code='"+columnCode+rowKey+"'>";
                        }
                        if(column.dictType=="datetimepicker"){
                            html=html+"<div class='input-group date'>";
                            html=html+"<span class='input-group-addon'><i class='fa fa-calendar'></i></span>";
                            html=html+"<input type='text' class='form-control datetimepicker' name='"+columnName+"' >";
                            html=html+"</div>"
                        }
                        if(column.dictType=="datepicker"){
                            html=html+"<div class='input-group date'>";
                            html=html+"<span class='input-group-addon'><i class='fa fa-calendar'></i></span>";
                            html=html+"<input type='text' class='form-control datepicker' name='"+columnName+"' >";
                            html=html+"</div>"
                        }
                        if(column.dictType=="radio"){
                            for(var j=0;j<column.dicts.length;j++){
                                html=html+"<div class='radio radio-box'>";
                                html=html+"<label style='padding-left: 0!important;'><input type='radio' value='"+column.dicts[j].dictId+"' name='"+columnName+"' data-score='"+column.dicts[j].dictScore+"' data-auto-score='"+result.data.dictAutoScore+"' data-row-key='"+rowKey+"' >"
                                html=html+column.dicts[j].dictTitle+"</label>";
                                html=html+"</div>"
                            }
                        }

                        if(column.dictType=="checkbox"){
                            for(var j=0;j<column.dicts.length;j++){
                                html=html+"<div class='check check-box'>";
                                html=html+"<label style='padding-left: 0!important;'><input type='checkbox' value='"+column.dicts[j].dictId+"' name='"+columnName+"'>"
                                html=html+column.dicts[j].dictTitle+"</label>";
                                html=html+"</div>"
                            }
                        }
                        html=html+"</td>";
                    }
                    if(result.data.dictCopy=="Y"){
                        html=html+"<td  data-id='"+rowKey+"'>"
                        html=html+"<button class='btn btn-danger btn-circle' type='button' onclick='removeTableRow(this)'  ><i class='fa fa-remove'></i></button>";
                        html=html+"</td>";
                    }

                    html=html+"</tr>"
                    $("#table"+dictId).append(html);
                    $("#tr"+rowKey).find(".datetimepicker").each(function () {
                        laydate.render({
                            elem: this,
                            trigger:'click',
                            type: 'datetime'
                        });
                    })
                    $("#tr"+rowKey).find(".datepicker").each(function () {
                        laydate.render({
                            trigger:'click',
                            elem: this
                        });
                    })
                    $(".check-box:not(.noicheck),.radio-box:not(.noicheck)").each(function() {
                        $(this).iCheck({
                            checkboxClass: 'icheckbox-blue',
                            radioClass: 'iradio-blue',
                        }).on('ifChanged', function (event) {
                            initAutoScore();
                        })
                    })
                }else{
                    $.modal.alertError(result.msg);
                }
            }
        })
    }

    function initScore(){
        var score=0;
        $(".selectRadio").each(function (i,obj){
            $(obj).removeClass("selectRadio")
        })
        $(".autoScore").each(function (i,obj){
            let dict=$(obj).attr("data-id");
            var score=0;
            $(obj).find("input[type='radio']:checked").each(function (i2,obj2) {
                if(undefined!=$(obj2).attr("data-score")){
                    score=$.common.accAdd(score,$(obj2).attr("data-score"));
                }
            })
            $("#ecScore"+dict).val(score);
            $("#totalScoreDiv"+dict).html("合计得分：<code>"+score+"</code>");
        })

        $("input[type='radio']:checked").each(function (i2,obj2) {
            $(obj2).parent().parent().addClass("selectRadio");
        })
        $("input[type='checkbox']:checked").each(function (i2,obj2) {
            $(obj2).parent().parent().addClass("selectRadio");
        })
    }

    function viewAllVideo(){

        var arr=[]
        $(".uploadFile").each(function(i,obj){
            arr.push($(obj).attr("data-file-name"))
        })
        window.parent.parent.viewAllVideo(arr);
    }
</script>
</body>
</html>
